import type { PageParam, PageResult } from '@vben/request';
import type { Dayjs } from 'dayjs';

import { requestClient } from '#/api/request';

export namespace BillItemsApi {
    /** 账单明细信息 */
  export interface BillItems {
            id: number; // 主键ID
            billId?: number; // 账单ID
            consumptionRecordId?: number; // 消费记录ID
            serviceName?: string; // 服务名称
            quantity?: number; // 数量
            unitPrice?: number; // 单价
            totalAmount?: number; // 总金额
            discountAmount: number; // 优惠金额
            actualAmount?: number; // 实收金额
      }
}

/** 查询账单明细分页 */
export function getBillItemsPage(params: PageParam) {
  return requestClient.get<PageResult<BillItemsApi.BillItems>>('/spa/bill-items/page', { params });
}

/** 查询账单明细详情 */
export function getBillItems(id: number) {
  return requestClient.get<BillItemsApi.BillItems>(`/spa/bill-items/get?id=${id}`);
}

/** 新增账单明细 */
export function createBillItems(data: BillItemsApi.BillItems) {
  return requestClient.post('/spa/bill-items/create', data);
}

/** 修改账单明细 */
export function updateBillItems(data: BillItemsApi.BillItems) {
  return requestClient.put('/spa/bill-items/update', data);
}

/** 删除账单明细 */
export function deleteBillItems(id: number) {
  return requestClient.delete(`/spa/bill-items/delete?id=${id}`);
}

/** 批量删除账单明细 */
export function deleteBillItemsList(ids: number[]) {
  return requestClient.delete(`/spa/bill-items/delete-list?ids=${ids.join(',')}`)
}

/** 导出账单明细 */
export function exportBillItems(params: any) {
  return requestClient.download('/spa/bill-items/export-excel', params);
}

